package org.example.struct.array;

/**
 * @author liyishan
 * @date 2024/4/7 14:39
 * @apiNote
 */

public class LCR128StockManagement {

    public int stockManagement(int[] stock) {
        int low = 0;
        int high = stock.length - 1;
        while (low < high) {
            int pivot = low + (high - low) / 2;
            if (stock[pivot] < stock[high]) {
                high = pivot;
            } else if (stock[pivot] > stock[high]) {
                low = pivot + 1;
            } else {
                high -= 1;
            }
        }
        return stock[low];
    }
}
